<?php
class Customer_Model_Trip extends Zend_Db_Table_Abstract
{
	/**
	 * Model name
	 * @var string
	 */
	protected $_name = 'trip';
	
	/**
	 * Primary column
	 * @var string
	 */
	protected $_primary = 'trip_id';
	
	/**
	 * Get trip info
	 * @param $tripID
	 * @return array
	 */
	public function getTripInfo($tripID) {
		$db = Zend_Db_Table::getDefaultAdapter();		
		$stmt = $db->query("CALL list_trip_info(?)", array($tripID));		
		$result = $stmt->fetchAll();	
		return empty($result) ? null : $result[0];	
	}
	
	/**
	 * Get trip array
	 * @param string $from
	 * @param string $to
	 * @param string $date
	 * @return array
	 */
	public function getTripArray($from, $to, $date)
	{
		$db = Zend_Db_Table::getDefaultAdapter();		
		$stmt = $db->query("CALL list_trip(?,?,?)", array($from, $to, $date));		
		$result = $stmt->fetchAll();		
		return $result;
	}

}